package com.burstly.lib.exception;

import com.burstly.lib.BurstlySdk;
import com.burstly.lib.component.IAdaptorController;
import com.burstly.lib.constants.Constants;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.Utils;
import java.lang.ref.WeakReference;

public final class UnhandledExceptionDumpWrapper
  implements Thread.UncaughtExceptionHandler
{
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private final WeakReference<IAdaptorController> mToDump;

  public UnhandledExceptionDumpWrapper(IAdaptorController paramIAdaptorController)
  {
    this.mToDump = new WeakReference(paramIAdaptorController);
  }

  public boolean equals(Object paramObject)
  {
    return paramObject instanceof UnhandledExceptionDumpWrapper;
  }

  public int hashCode()
  {
    return 1;
  }

  public void uncaughtException(Thread paramThread, Throwable paramThrowable)
  {
    IAdaptorController localIAdaptorController = (IAdaptorController)this.mToDump.get();
    StackTraceElement[] arrayOfStackTraceElement;
    int i;
    if (localIAdaptorController != null)
    {
      LOG.logError("ComponentDumper", "Current component state will be printed below. It DOES NOT mean that Burstly caused this uncaught exception it just dumps current component state to make it easier to find the cause of this exception if it is caused by Burstly code.", new Object[0]);
      arrayOfStackTraceElement = paramThrowable.getStackTrace();
      i = arrayOfStackTraceElement.length;
    }
    for (int j = 0; ; j++)
      if (j < i)
      {
        if (arrayOfStackTraceElement[j].toString().indexOf("com.burstly.lib.") != -1)
        {
          Utils.addInStackTrace(paramThrowable, localIAdaptorController.toString());
          Utils.addInStackTrace(paramThrowable, "BurstlySDK=" + BurstlySdk.getSdkVersion() + "-" + Constants.BUILD_ID);
        }
      }
      else
      {
        LOG.logError("ComponentDumper", "Dump finished.", new Object[0]);
        return;
      }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.exception.UnhandledExceptionDumpWrapper
 * JD-Core Version:    0.6.2
 */